{template header.html}
<script type="text/javascript">
$(function() {
    {if $error}
        dr_tips('{$error}',5);
    {/if}
     dr_remote({intval($data.type)});
});

function dr_remote(id) {
    $(".r1").hide();
    $(".r2").hide();
    $(".r3").hide();
    $(".r"+id).show();
}
function dr_aliyun_host(val) {
    $('#rurl').val('http://'+$('#aliyun_bucket').val()+'.'+val);
}
function remote_test() {
    var type = $('input:radio[name=type]:checked').val();;
    if (type == '1') {
        ftp_test();
    } else if (type == '2') {
        baidu_test();
    } else if (type == '3') {
        aliyun_test();
    }
}
function ftp_test() {
    var host = $('#host').val();
    var port = $('#port').val();
    var username = $('#username').val();
    var password = $('#password').val();
    var rurl = $('#rurl').val();
    var path = $("#path").val();
    var pasv = $(".pasv:checked").val();
    var mode = $(".mode:checked").val();
    $("#ftptest").val('Loading');
    $.get("{dr_url('api/testftp')}",{rurl:rurl,host:host,port:port,username:username,password:password,pasv:pasv,path:path,mode:mode}, function(data){
        alert(data);
        $("#ftptest").val('{lang('html-127')}');
    })
}
function aliyun_test() {
    var id = $('#aliyun_id').val();
    var secret = $('#aliyun_secret').val();
    var bucket = $('#aliyun_bucket').val();
    var host = $('#aliyun_host').val();
    var rurl = $('#rurl').val();
    $("#ftptest").val('Loading');
    $.get("{dr_url('api/aliyuntest')}",{rurl:rurl,id:id,secret:secret,bucket:bucket,host:host}, function(data){
        alert(data);
        $("#ftptest").val('{lang('html-127')}');
    })
}
function baidu_test() {
    var ak = $('#baidu_ak').val();
    var sk = $('#baidu_sk').val();
    var bucket = $('#baidu_bucket').val();
    var host = $('#baidu_host').val();
    $('#rurl').val('http://'+host+'/'+bucket);
    var rurl = $('#rurl').val();
    $("#ftptest").val('Loading');
    $.get("{dr_url('api/baidutest')}",{rurl:rurl,ak:ak,sk:sk,bucket:bucket,host:host}, function(data){
        alert(data);
        $("#ftptest").val('{lang('html-127')}');
    })
}
</script>
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		{$menu}
	</div>
	<div class="bk10"></div>
    <div class="table-list col-tab">
        <ul class="tabBut cu-li">
            <li class="on">{lang('html-085')}</li>
        </ul>
        <div class="contentList pad-10">
		<form action="" method="post" id="myform" name="myform">
		<table width="100%" class="table_form">
		<tr>
			<th width="200">{lang('html-028')}：</th>
			<td>
			{loop $ci->type $i $n}
			<input type="radio" name="type" onclick="dr_remote({$i})" value="{$i}" {if (int)$data['type'] == $i}checked{/if} />&nbsp;<label>{$n}</label>&nbsp;&nbsp;&nbsp;&nbsp;
			{/loop}
			</td>
		</tr>
		<tr>
			<th>{lang('html-026')}： </th>
			<td>
			<input type="text" required size="25" value="{$data.name}" name="data[name]" class="input-text" />
			<div class="onShow">{lang('html-027')}</div>
			</td>
		</tr>
            <tr class="r1">
                <th>{lang('html-107')}： </th>
                <td>
                    <input id="host" class="input-text" type="text" name="data[value][host1]" value="{$data['value']['host']}" size="25" />
                    <div class="onShow">{lang('html-108')}</div>
                </td>
            </tr>
            <tr class="r1">
                <th>{lang('html-109')}： </th>
                <td>
                    <input id="port" class="input-text" type="text" name="data[value][port]" value="{$data['value']['port']}" size="10" />
                    <div class="onShow">{lang('html-110')}</div>
                </td>
            </tr>
            <tr class="r1">
                <th>{lang('html-111')}： </th>
                <td>
                    <input id="username" class="input-text" type="text" name="data[value][username]" value="{$data['value']['username']}" size="25" />
                    <div class="onShow">{lang('html-112')}</div>
                </td>
            </tr>
            <tr class="r1">
                <th>{lang('html-113')}： </th>
                <td>
                    <input id="password" class="input-text" type="password" name="data[value][password]" value="{$data['value']['password']}" size="25" />
                    <div class="onShow">{lang('html-114')}</div>
                </td>
            </tr>
            <tr class="r1">
                <th>{lang('html-115')}： </th>
                <td>
                    <input id="path" class="input-text" type="text" name="data[value][path]" value="{$data['value']['path']}" size="25" />
                    <div class="onShow">{lang('html-116')}</div>
                </td>
            </tr>
            <tr class="r1">
                <th>{lang('html-117')}： </th>
                <td>
                    <input class="pasv" type="radio" name="data[value][pasv]" value="1" {if $data['value']['pasv']}checked{/if} />&nbsp;<label>{lang('open')}</label>
                    &nbsp;&nbsp;&nbsp;
                    <input class="pasv" type="radio" name="data[value][pasv]" value="0" {if empty($data['value']['pasv'])}checked{/if} />&nbsp;<label>{lang('close')}</label>
                    <div class="onShow">{lang('html-118')}</div>
                </td>
            </tr>
            <tr class="r1">
                <th>{lang('html-119')}： </th>
                <td>
                    <input class="mode" type="radio" name="data[value][mode]" value="auto" {if empty($data['value']['mode']) || $data['value']['mode'] == 'auto'}checked{/if} />&nbsp;<label>{lang('html-120')}</label>
                    &nbsp;&nbsp;&nbsp;
                    <input class="mode" type="radio" name="data[value][mode]" value="ascii" {if $data['value']['mode']=='ascii'}checked{/if} />&nbsp;<label>{lang('html-121')}</label>
                    &nbsp;&nbsp;&nbsp;
                    <input class="mode" type="radio" name="data[value][mode]" value="binary" {if $data['value']['mode']=='binary'}checked{/if} />&nbsp;<label>{lang('html-122')}</label>
                </td>
            </tr>

            <tr class="r2">
                <th>AK： </th>
                <td>
                    <input id="baidu_ak" class="input-text" type="text" name="data[value][ak]" value="{$data['value']['ak']}" size="40" />
                </td>
            </tr>
            <tr class="r2">
                <th>SK： </th>
                <td>
                    <input id="baidu_sk" class="input-text" type="text" name="data[value][sk]" value="{$data['value']['sk']}" size="40" />
                </td>
            </tr>
            <tr class="r2">
                <th>Bucket： </th>
                <td>
                    <input id="baidu_bucket" class="input-text" type="text" name="data[value][bucket]" value="{$data['value']['bucket']}" size="40" />
                </td>
            </tr>
            <tr class="r2">
                <th>Host： </th>
                <td>
                    <input id="baidu_host" class="input-text" type="text" name="data[value][host2]" value="{$data['value']['host']}" size="40" />
                </td>
            </tr>

            <tr class="r3">
                <th>Access Key ID： </th>
                <td>
                    <input id="aliyun_id" class="input-text" type="text" name="data[value][id]" value="{$data['value']['id']}" size="25" />
                </td>
            </tr>
            <tr class="r3">
                <th>Access Key Secret： </th>
                <td>
                    <input id="aliyun_secret" class="input-text" type="text" name="data[value][secret]" value="{$data['value']['secret']}" size="40" />
                </td>
            </tr>
            <tr class="r3">
                <th>Bucket： </th>
                <td>
                    <input id="aliyun_bucket" class="input-text" type="text" name="data[value][bucket]" value="{$data['value']['bucket']}" size="25" />
                </td>
            </tr>
            <tr class="r3">
                <th>节点请求地址： </th>
                <td>
                    <select id="aliyun_host" onchange="dr_aliyun_host(this.value)" name="data[value][host3]">
                        <option value="">选择节点</option>
                        <option {if $data['value']['host']=='oss-cn-hangzhou.aliyuncs.com'}selected{/if} value="oss-cn-hangzhou.aliyuncs.com">杭州节点</option>
                        <option {if $data['value']['host']=='oss-cn-qingdao.aliyuncs.com'}selected{/if} value="oss-cn-qingdao.aliyuncs.com">青岛节点</option>
                        <option {if $data['value']['host']=='oss-cn-beijing.aliyuncs.com'}selected{/if} value="oss-cn-beijing.aliyuncs.com">北京节点</option>
                        <option {if $data['value']['host']=='oss-cn-hongkong.aliyuncs.com'}selected{/if} value="oss-cn-hongkong.aliyuncs.com">香港节点</option>
                        <option {if $data['value']['host']=='oss-cn-shenzhen.aliyuncs.com'}selected{/if} value="oss-cn-shenzhen.aliyuncs.com">深圳节点</option>
                    </select>
                </td>
            </tr>


            <tr>
                <th>{lang('html-123')}： </th>
                <td>
                    <input class="input-text" type="text" name="data[exts]" value="{$data['exts']}" size="40" />
                    <div class="onShow">{lang('html-124')}</div>
                </td>
            </tr>
            <tr>
                <th>{lang('html-125')}： </th>
                <td>
                    <input id="rurl" class="input-text" type="text" name="data[url]" value="{$data['url']}" size="60" />
                    <input class="button" type="button" name="button" id="ftptest" onclick="remote_test()" value="{lang('html-127')}" />
                </td>
            </tr>
            <tr class="r2">
                <th> </th>
                <td><a href="http://help.dayrui.com/170.html" target="_blank" style="color:blue">百度云存储BCS配置教程</a></td>
            </tr>

            <tr class="r3">
                <th> </th>
                <td><a href="http://help.dayrui.com/169.html" target="_blank" style="color:blue">阿里云存储OSS配置教程</a></td>
            </tr>
		<tr>
			<th> </th>
			<td><input value="{lang('submit')}" type="submit" name="submit" class="button" />
			</td>
		</tr>
		</table>
		</form>
	    </div>
	</div>
</div>
{template footer.html}